module.exports = (app) => {
  const { STRING, BOOLEAN } = app.Sequelize;

  const User = app.model.define('user', {
    user_name: {
      type: STRING,
      allowNull: false,
      unique: true,
      comment: '用户名，唯一',
    },
    password: {
      type: STRING(64),
      allowNull: false,
      comment: '密码',
    },
    is_admin: {
      type: BOOLEAN,
      allowNull: false,
      defaultValue: 0,
      comment: '是否管理员',
    },
  });

  return User;
};
